﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Data.SqlClient;
using System.Data;

namespace WebService
{
    public class NhanVienDAO
    {
        public NhanVienDTO[] GetDanhSachNhanVien()
        {
            NhanVienDTO[] dsNhanVien;
            string query = "SELECT * FROM NhanVien";
            DataTable dt = DataProvider.excecuteQuery(query);
            int i, n = dt.Rows.Count;
            dsNhanVien = new NhanVienDTO[n];
            for (i = 0; i < n; i++)
            {
                NhanVienDTO nv = new NhanVienDTO();
                nv.MaNV = (int)dt.Rows[i]["MaNV"];
                nv.TenNV = dt.Rows[i]["TenNV"].ToString();
                nv.UserName = dt.Rows[i]["Username"].ToString();
                nv.PassWord = dt.Rows[i]["Password"].ToString();
                nv.ThongTinCaNhan = dt.Rows[i]["ThongTinCaNhan"].ToString();
                dsNhanVien[i] = nv;
            }
            return dsNhanVien ;
        }
    }
}